<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/mastra.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Mastra Playground</title>
    <script>
      function connectSSE() {
        const events = new EventSource('/refresh-events');

        events.onmessage = event => {
          if (event.data === 'refresh') {
            window.location.reload();
          }
        };

        events.onerror = () => {
          events.close();
          setTimeout(connectSSE, 1000);
        };

        window.addEventListener('beforeunload', () => {
          events.close();
        });
      }

      connectSSE();
    </script>
  </head>
  <body>
    <div id="root" class="dark"></div>
    <script type="module" src="/src/main.tsx"></script>
  </body>
</html>
